﻿// STATS MODULE
//      Luca Puccini
//      Marco Cornolti
//      Michele Sottile
//      Matteo Parchi

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace Stats.Objects
{
    /// <summary>
    /// Represents the object for encapsulate a single feedback read from DB
    /// </summary>
    [DataContract]
    public class Feedback
    {
        /// <summary>
        /// Parameterless costructor
        /// </summary>
        //WS Parameterless costructor (Required to make Feedback class serialized)
        public Feedback() { }

        /// <summary>
        /// Feedback type..TRUE = feedback left for the user as driver ( from PSN to DRV) ... FALSE = as passenger (from DRV to PSN)
        /// </summary>
        [DataMember]
        public bool feedbackType { get; set; }

        /// <summary>
        /// The ID of the trip which the feedback is related to
        /// </summary>
        [DataMember]
        public int tripID { get; set; }

        /// <summary>
        /// The departure date of the trip which the feedback is related to
        /// </summary>
        [DataMember]
        public DateTime departureDate { get; set; }

        /// <summary>
        /// Feedback receiver user ID
        /// </summary>
        [DataMember]
        public int receiverID { get; set; }

        /// <summary>
        /// Feedback sender user nickname
        /// </summary>
        [DataMember]
        public String receiverNickname { get; set; }

        /// <summary>
        /// Feedback sender user ID
        /// </summary>
        [DataMember]
        public int senderID { get; set; }

        /// <summary>
        /// User feedback sender nickname
        /// </summary>
        [DataMember]
        public String senderNickname { get; set; }

        /// <summary>
        /// General vote left for the user
        /// </summary>
        [DataMember]
        public int generalVote { get; set; }

        /// <summary>
        /// Punctuality vote left for the user
        /// </summary>
        [DataMember]
        public int punctualityVote { get; set; }

        /// <summary>
        /// Reliability vote left for the user
        /// </summary>
        [DataMember]
        public int reliabilityVote { get; set; }
                
        /// <summary>
        /// Courtesy vote left in the feedback for the user as driver only
        /// (when feedback left as passenger this field is set to zero and not displayed)
        /// (ignore if feedback type is false)
        /// </summary>
        [DataMember]
        public int courtesyVote { get; set; }

        /// <summary>
        /// Comment left for the user
        /// </summary>
        [DataMember]
        public string commentLeft { get; set; }

        /// <summary>
        /// Origin city of the trip which the feedback is related
        /// </summary>
        [DataMember]
        public string originCity { get; set; }

        /// <summary>
        /// Origin address of the trip which the feedback is related
        /// </summary>
        [DataMember]
        public string originAddress { get; set; }

        /// <summary>
        /// Destination city of the trip which the feedback is related
        /// </summary>
        [DataMember]
        public string destinationCity { get; set; }

        /// <summary>
        /// Destination address of the trip which the feedback is related
        /// </summary>
        [DataMember]
        public string destinationAddress { get; set; }

        /// <summary>
        /// The constructor for the Feedback object
        /// </summary>
        /// <param name="type"></param>
        /// <param name="trip_ID">The ID of the trip which the feedback is related to</param>
        /// <param name="departure_Date">The departure date of the trip which the feedback is related to</param>
        /// <param name="receiver_ID">Feedback receiver user ID</param>
        /// <param name="receiver_Nickname">Feedback receiver user nickname</param>
        /// <param name="sender_ID">Feedback sender user ID</param>
        /// <param name="sender_Nickname">User feedback sender nickname</param>
        /// <param name="general_Vote">General vote left for the user</param>
        /// <param name="punctuality_Vote">Punctuality vote left for the user</param>
        /// <param name="reliability_Vote">Reliability vote left for the user</param>
        /// <param name="courtesy_Vote">Courtesy vote left in the feedback (for the user as driver only)</param>
        /// <param name="comment">Comment left for the user</param>
        /// <param name="origin_City">Origin city of the trip which the feedback is related to</param>
        /// <param name="origin_Address">Origin address of the trip which the feedback is related to</param>
        /// <param name="destination_City">Destination city of the trip which the feedback is related to</param>
        /// <param name="destination_Address">Destination address of the trip which the feedback is related to</param>
        /// <example>
        /// <code>
        /// Feedback fdb = new Feedback(True,670,"16/05/2008",432,"matt777",303,"matt",6,7,4,7,"good driver","Pisa","Via Buonarroti","Roma","Via Tiburtina");
        /// </code>
        /// </example>
        public Feedback (bool type, int trip_ID, DateTime departure_Date, int receiver_ID, String receiver_Nickname, int sender_ID, String sender_Nickname, int general_Vote, int punctuality_Vote, int reliability_Vote, int courtesy_Vote, string comment, string origin_City, string origin_Address, String destination_City, String destination_Address)
        {
            
            feedbackType = type; // TRUE = feedback left for the user as driver...FALSE = feedback left for the user as passenger

            tripID = trip_ID;
            departureDate = departure_Date;
            
            senderNickname = sender_Nickname;
            receiverNickname = receiver_Nickname;

            receiverID = receiver_ID;
            senderID = sender_ID;

            generalVote = general_Vote;
            punctualityVote = punctuality_Vote;
            reliabilityVote = reliability_Vote;
            courtesyVote = courtesy_Vote;
            
            commentLeft = comment;

            originCity = origin_City;
            originAddress = origin_Address;
            destinationCity = destination_City;
            destinationAddress = destination_Address;
        }


        
    }
}
